﻿
Imports System.IO

Public Class autoflushFileStream
    Inherits FileStream

    Public Sub New(ByVal path As String, ByVal mode As FileMode, ByVal access As FileAccess, ByVal share As FileShare)
        MyBase.New(path, mode, access, share)
    End Sub

    Public Overrides Sub Close()
        On Error Resume Next
        Flush()
        MyBase.Close()
    End Sub

    Protected Overrides Sub Finalize()
        Close()
        MyBase.Finalize()
    End Sub
End Class
